#!/usr/bin/python3
# -*- coding: utf-8 -*-

"""
# @version: v1.0
# @author : wlisingle
# @Email : 19688513@qq.com
# @Project : g-carbon-bio
# @File : stock_individual_fund_flow.py
# @Software: PyCharm
# @time: 2025/2/20 14:00
# @description : 个股资金流数据
"""

class StockIndividualFundFlow:
    def __init__(self, date, closing_price, price_change, net_inflow_large, proportion_inflow_large,
                 net_inflow_super_large, proportion_inflow_super_large,
                 net_inflow_medium, proportion_inflow_medium,
                 net_inflow_small, proportion_inflow_small,
                 total_net_inflow_positive, total_net_inflow_negative):
        """
        初始化个股资金流数据实例。

        :param date: 交易日期
        :param closing_price: 收盘价
        :param price_change: 涨跌幅（单位：%）
        :param net_inflow_large: 大单净流入净额
        :param proportion_inflow_large: 大单净流入净占比（单位：%）
        :param net_inflow_super_large: 超大单净流入净额
        :param proportion_inflow_super_large: 超大单净流入净占比（单位：%）
        :param net_inflow_medium: 中单净流入净额
        :param proportion_inflow_medium: 中单净流入净占比（单位：%）
        :param net_inflow_small: 小单净流入净额
        :param proportion_inflow_small: 小单净流入净占比（单位：%）
        :param total_net_inflow_positive: 正净流入总和
        :param total_net_inflow_negative: 负净流入总和
        """
        self._date = date
        self._closing_price = closing_price
        self._price_change = price_change
        self._net_inflow_large = net_inflow_large
        self._proportion_inflow_large = proportion_inflow_large
        self._net_inflow_super_large = net_inflow_super_large
        self._proportion_inflow_super_large = proportion_inflow_super_large
        self._net_inflow_medium = net_inflow_medium
        self._proportion_inflow_medium = proportion_inflow_medium
        self._net_inflow_small = net_inflow_small
        self._proportion_inflow_small = proportion_inflow_small
        self._total_net_inflow_positive = total_net_inflow_positive  # 正净流入总和
        self._total_net_inflow_negative = total_net_inflow_negative  # 负净流入总和

    # Getter 和 Setter 方法
    @property
    def date(self):
        """获取交易日期"""
        return self._date

    @date.setter
    def date(self, date):
        """设置交易日期"""
        self._date = date

    @property
    def closing_price(self):
        """获取收盘价"""
        return self._closing_price

    @closing_price.setter
    def closing_price(self, closing_price):
        """设置收盘价"""
        self._closing_price = closing_price

    @property
    def price_change(self):
        """获取涨跌幅（单位：%）"""
        return self._price_change

    @price_change.setter
    def price_change(self, price_change):
        """设置涨跌幅（单位：%）"""
        self._price_change = price_change

    @property
    def net_inflow_large(self):
        """获取大单净流入净额"""
        return self._net_inflow_large

    @net_inflow_large.setter
    def net_inflow_large(self, net_inflow_large):
        """设置大单净流入净额"""
        self._net_inflow_large = net_inflow_large

    @property
    def proportion_inflow_large(self):
        """获取大单净流入净占比（单位：%）"""
        return self._proportion_inflow_large

    @proportion_inflow_large.setter
    def proportion_inflow_large(self, proportion_inflow_large):
        """设置大单净流入净占比（单位：%）"""
        self._proportion_inflow_large = proportion_inflow_large

    @property
    def net_inflow_super_large(self):
        """获取超大单净流入净额"""
        return self._net_inflow_super_large

    @net_inflow_super_large.setter
    def net_inflow_super_large(self, net_inflow_super_large):
        """设置超大单净流入净额"""
        self._net_inflow_super_large = net_inflow_super_large

    @property
    def proportion_inflow_super_large(self):
        """获取超大单净流入净占比（单位：%）"""
        return self._proportion_inflow_super_large

    @proportion_inflow_super_large.setter
    def proportion_inflow_super_large(self, proportion_inflow_super_large):
        """设置超大单净流入净占比（单位：%）"""
        self._proportion_inflow_super_large = proportion_inflow_super_large

    @property
    def net_inflow_medium(self):
        """获取中单净流入净额"""
        return self._net_inflow_medium

    @net_inflow_medium.setter
    def net_inflow_medium(self, net_inflow_medium):
        """设置中单净流入净额"""
        self._net_inflow_medium = net_inflow_medium

    @property
    def proportion_inflow_medium(self):
        """获取中单净流入净占比（单位：%）"""
        return self._proportion_inflow_medium

    @proportion_inflow_medium.setter
    def proportion_inflow_medium(self, proportion_inflow_medium):
        """设置中单净流入净占比（单位：%）"""
        self._proportion_inflow_medium = proportion_inflow_medium

    @property
    def net_inflow_small(self):
        """获取小单净流入净额"""
        return self._net_inflow_small

    @net_inflow_small.setter
    def net_inflow_small(self, net_inflow_small):
        """设置小单净流入净额"""
        self._net_inflow_small = net_inflow_small

    @property
    def proportion_inflow_small(self):
        """获取小单净流入净占比（单位：%）"""
        return self._proportion_inflow_small

    @proportion_inflow_small.setter
    def proportion_inflow_small(self, proportion_inflow_small):
        """设置小单净流入净占比（单位：%）"""
        self._proportion_inflow_small = proportion_inflow_small

    @property
    def total_net_inflow_positive(self):
        """获取正净流入总和"""
        return self._total_net_inflow_positive

    @total_net_inflow_positive.setter
    def total_net_inflow_positive(self, total_net_inflow_positive):
        """设置正净流入总和"""
        self._total_net_inflow_positive = total_net_inflow_positive

    @property
    def total_net_inflow_negative(self):
        """获取负净流入总和"""
        return self._total_net_inflow_negative

    @total_net_inflow_negative.setter
    def total_net_inflow_negative(self, total_net_inflow_negative):
        """设置负净流入总和"""
        self._total_net_inflow_negative = total_net_inflow_negative

    def __str__(self):
        # 计算净值
        net_value = self.total_net_inflow_positive + self.total_net_inflow_negative
        return (f"日期: {self.date}, 收盘价: {self.closing_price}, 涨跌幅: {self.price_change}%, "
                f"大单净流入: {self.net_inflow_large}, 超大单净流入: {self.net_inflow_super_large}, "
                f"中单净流入: {self.net_inflow_medium}, 小单净流入: {self.net_inflow_small}, "
                f"净值: {net_value}")
